package com.thinkgsp.sys.service;

import java.util.List;

import org.springframework.security.core.userdetails.UserDetailsService;

import com.thinkgsp.sys.model.SysUser;
import com.thinkgsp.sys.persistence.SysUserMapper;

/**
 * 系统用户业务类
 * @author evan
 *
 */
public interface SysUserService extends UserDetailsService {

    /**
     * Convenience method for testing - allows you to mock the Mapper and set it on an interface.
     * @param userMapper the SysUserMapper implementation to use
     */
	public void setSysUserMapper(SysUserMapper userMapper);
    /**
     * Retrieves a user by userId.  An exception is thrown if user not found
     *
     * @param userId the identifier for the user
     * @return User
     */	
	SysUser getUser(Integer userId);
	
    /**
     * Finds a user by their username.
     *
     * @param username the user's username used to login
     * @return User a populated user object
     */	
	SysUser getUserByUsername(String username);
	
    /**
     * Retrieves a list of all users.
     *
     * @return List
     */	
	List<SysUser> getUsers();
	
    /**
     * Saves a user's information
     *
     * @param user the user's information
     * @return updated user
     * @throws UserExistsException thrown when user already exists
     */	
	SysUser saveUser(SysUser user) throws UserExistsException;
	
    /**
     * Removes a user from the database by their userId
     *
     * @param userId the user's id
     */	
	void removeUser(Integer userId);
	
	/**
	 * 添加用户角色
	 * @param userId
	 * @param roleId
	 */
	void addRole(Integer userId,Integer roleId);
	
	/**
	 * 删除用户角色
	 * @param userId
	 * @param roleId
	 */
	void deleteRole(Integer userId,Integer roleId);
	
	/**
	 * 添加用户库房
	 * @param userId
	 * @param invAddId
	 */
	@Deprecated
	void addUserInvAdd(Integer userId,Integer invAddId);
	
	/**
	 * 添加用户的可访问部门
	 * @param userId
	 * @param deptId
	 */
	void addUserDept(Integer userId,Integer deptId);
	
	/**
	 * 删除用户库房
	 * @param userId
	 * @param invAddId
	 */
	@Deprecated
	void delelteUserInvAdd(Integer userId,Integer invAddId);
	
	/**
	 * 删除用户的可访问部门
	 * @param userId
	 * @param deptId
	 */
	void deleteUserDept(Integer userId,Integer deptId);
	
	/**
	 * 设置用户的默认库房
	 * @param userId
	 * @param invAddId
	 */
	@Deprecated
	void setDefaultInvAdd(Integer userId,Integer invAddId);
	
	/**
	 * 设置用户的默认访问部门
	 * @param userId
	 * @param deptId
	 */
	void setDefaultDept(Integer userId,Integer deptId);
}
